package jpa.entitys.promis.sales;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the MAILLING_ADDRESSES database table.
 * 
 */
@Embeddable
public class MaillingAddressPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="CUSTOMER_CODE", unique=true, nullable=false, length=30)
	private String customerCode;

	@Column(name="ADDRESS_CODE", unique=true, nullable=false, precision=2)
	private long addressCode;

    public MaillingAddressPK() {
    }
	public String getCustomerCode() {
		return this.customerCode;
	}
	public void setCustomerCode(String customerCode) {
		this.customerCode = customerCode;
	}
	public long getAddressCode() {
		return this.addressCode;
	}
	public void setAddressCode(long addressCode) {
		this.addressCode = addressCode;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof MaillingAddressPK)) {
			return false;
		}
		MaillingAddressPK castOther = (MaillingAddressPK)other;
		return 
			this.customerCode.equals(castOther.customerCode)
			&& (this.addressCode == castOther.addressCode);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.customerCode.hashCode();
		hash = hash * prime + ((int) (this.addressCode ^ (this.addressCode >>> 32)));
		
		return hash;
    }
}